'''
$Revision: 62 $
$LastChangedDate: 2008-03-13 18:10:27 +0000 (Thu, 13 Mar 2008) $
Some basic unittesting
Really need to expand this.
'''
import unittest

from MomentClosure.Factorial import *

class TestFactorial(unittest.TestCase):
    '''Tests the factorial, binomial and pow functions'''
    
    def setUp(self):
        pass

    def testFactorial(self):
        self.assertEqual(factorial(0), 1)
        self.assertEqual(factorial(1), 1)
        self.assertEqual(factorial(2), 2)		
        self.assertEqual(factorial(3), 6)		
    
    def testBinomial(self):
        self.assertEqual(binomial(0,0), 1)
        self.assertEqual(binomial(1,1), 1)
        self.assertEqual(binomial(2,0), 1)
        self.assertEqual(binomial(5,3), 10)

    def testBinomialM(self):
        self.assertEqual(binomialM((0,),(0,)), 1)
        self.assertEqual(binomialM((2,),(2,)), 1)
        self.assertEqual(binomialM((5,),(3,)), 10)

        self.assertEqual(binomialM((0,0),(0,0)), 1)
        self.assertEqual(binomialM((1,1),(0,0)), 1)
        self.assertEqual(binomialM((5,0),(3,0)), 10)
        self.assertEqual(binomialM((5,5),(3,3)), 100)
        
if __name__ == '__main__':
    unittest.main()
